/*******************************************************************************
 * Copyright (c) 2012 AwOiSoAk.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     $AwOiSoAk - initial API and implementation
 ******************************************************************************/
package com.awoisoak.dundeeguide;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Attractions extends Activity implements OnItemClickListener {
	
	private String[] stringAttractions;
	private ListView listViewAttractions;
	private ArrayAdapter<String> aa;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.attractions);
		
		stringAttractions= new String[] {"Dundee Law","McManus Galleries","Discovery Point","High Street","Broughty Ferry Castle"};
		listViewAttractions = (ListView)findViewById(R.id.listViewAttractions);
		aa = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,stringAttractions);
		listViewAttractions.setAdapter(aa);
		listViewAttractions.setOnItemClickListener(this);
		

}

	@Override
	public void onItemClick(AdapterView<?> av, View v, int position, long arg3) {
		String item = stringAttractions[position].toString();
		Intent i;
		String coord= null;
		int explanation=0;
		
			if (item=="Dundee Law"){
				coord="56.469748,-2.989334";
				explanation=R.string.Dundee_Law;}
			
			else if (item=="McManus Galleries"){
				coord="56.462608,-2.971165";
				explanation=R.string.MacManus_Galleries;}
			
			else if (item=="Discovery Point"){
				coord="56.456848,-2.968358";
				explanation=R.string.Discovery_Point;}
			
			else if (item=="High Street"){
				coord="56.460628,-2.970041";
				explanation=R.string.High_Street;}
			
			else if (item=="Broughty Ferry Castle"){
				coord="56.462976,-2.870085";
				explanation=R.string.Broughty_Ferry;}

		i = new Intent(Attractions.this,Attraction.class);  
		i.putExtra("tag_coordinate", coord);
		i.putExtra("tag_place", item);
		i.putExtra("tag_explanation", explanation);
		startActivity(i);
			
			
		
	}
}
